package com.atguigu.auth.handler;

import com.atguigu.auth.result.ResultCodeEnum;
import lombok.Data;

/**
 * @author 赵星
 * @version 1.0
 * @Date 2023/10/11 12:25
 */
@Data
public class GuiguException extends RuntimeException{
    public Integer code;
    public String msg;

    //传入枚举
    public GuiguException (ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMessage();
    }
    //code和msg
    public GuiguException (Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }


    @Override
    public String toString() {
        return "GuiguException{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
